package cn.bd13.login.utils;

import cn.bd13.login.entity.ReturnResult;

/**
 * ClassName：ReturnUtils
 * Package:cn.bd13.login.utils
 * Description:
 *
 * @Date:2020/5/11 21:19
 * @Author:zhangqiang@kgc.cn
 */
public class ReturnUtils {
    public static ReturnResult returnSuccess(){
        ReturnResult result=new ReturnResult();
        result.setCode(200);
        return result;
    }
    public static ReturnResult returnSuccess(String msg){
        ReturnResult result=new ReturnResult();
        result.setCode(200);
        result.setMsg(msg);
        return result;
    }
    public static ReturnResult returnSuccessWithData(Object data){
        ReturnResult result=new ReturnResult();
        result.setCode(200);
        result.setData(data);
        return result;
    }
    public static ReturnResult returnSuccess(Object data,String msg){
        ReturnResult result=new ReturnResult();
        result.setCode(200);
        result.setData(data);
        result.setMsg(msg);
        return result;
    }
    public static ReturnResult returnFailed(int code){
        ReturnResult result=new ReturnResult();
        result.setCode(code);
        return result;
    }
    public static ReturnResult returnFailed(int code,String msg){
        ReturnResult result=new ReturnResult();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }
    public static ReturnResult returnFailedWithData(int code,Object data){
        ReturnResult result=new ReturnResult();
        result.setCode(code);
        result.setData(data);
        return result;
    }
}
